<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:Apex.Controls"
    xmlns:converters="clr-namespace:Apex.Converters">

    <converters:StringNullOrEmptyToVisibilityConverter x:Key="StringNullOrEmptyToVisibilityConverter" />

    <LinearGradientBrush x:Key="SearchTextBoxBorder" EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
        <GradientStop Color="#ABADB3" Offset="0.05"/>
        <GradientStop Color="#E2E3EA" Offset="0.07"/>
        <GradientStop Color="#E3E9EF" Offset="1"/>
    </LinearGradientBrush>





    <SolidColorBrush x:Key="SearchTextBox_Background" Color="White" />
    <SolidColorBrush x:Key="SearchTextBox_Foreground" Color="Black" />
    <LinearGradientBrush x:Key="SearchTextBox_Border" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFABADB3" Offset="0.05" />
        <GradientStop Color="#FFE2E3EA" Offset="0.07" />
        <GradientStop Color="#FFE3E9EF" Offset="1" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="SearchTextBox_BorderMouseOver" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FF5C97C1" Offset="0.05" />
        <GradientStop Color="#FFB9D7EB" Offset="0.07" />
        <GradientStop Color="#FFC7E2F1" Offset="1" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="SearchTextBox_SearchIconBorder" Color="White" />
    <SolidColorBrush x:Key="SearchTextBox_SearchIconBackground" Color="White" />
    <LinearGradientBrush x:Key="SearchTextBox_SearchIconBorder_MouseOver" StartPoint="0,0" EndPoint="0,1" >
        <GradientStop Color="#FFFFFFFF" Offset="0" />
        <GradientStop Color="#FFE5F4FC" Offset="1" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="SearchTextBox_SearchIconBackground_MouseOver" StartPoint="0,0" EndPoint="0,1" >
        <GradientStop Color="#FFE7F5FD" Offset="0" />
        <GradientStop Color="#FFD2EDFC" Offset="0.5" />
        <GradientStop Color="#FFB6E3FD" Offset="0.51" />
        <GradientStop Color="#FF9DD5F3" Offset="1" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="SearchTextBox_SearchIconBorder_MouseDown" StartPoint="0,0" EndPoint="0,1" >
        <GradientStop Color="#FFFFFFFF" Offset="0" />
        <GradientStop Color="#FFE5F4FC" Offset="1" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="SearchTextBox_SearchIconBackground_MouseDown" StartPoint="0,0" EndPoint="0,1" >
        <GradientStop Color="#FFE7F5FD" Offset="0" />
        <GradientStop Color="#FFD2EDFC" Offset="0.5" />
        <GradientStop Color="#FFB6E3FD" Offset="0.51" />
        <GradientStop Color="#FF9DD5F3" Offset="1" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="SearchTextBox_LabelTextColor" Color="Gray" />
    
    
    
    
    

    <Style x:Key="{x:Type controls:SearchTextBox}" TargetType="{x:Type controls:SearchTextBox}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
        <Setter Property="BorderBrush" Value="{StaticResource SearchTextBoxBorder}" />
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Padding" Value="1"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type controls:SearchTextBox}">
                    <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
                  BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid x:Name="LayoutGrid">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent},
                                                  Path=ActualHeight}" />
                            </Grid.ColumnDefinitions>
                            <ScrollViewer Margin="2" x:Name="PART_ContentHost" Grid.Column="0" />
                            <TextBlock 
                                x:Name="PART_CueLabel"  Margin="6,2,2,2" Grid.Column="0" Cursor="IBeam"
                                Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=CueText}"
                                Visibility="{Binding Path=Text, RelativeSource={RelativeSource TemplatedParent}, 
                                Converter={StaticResource StringNullOrEmptyToVisibilityConverter}, ConverterParameter=Invert}"
                                   Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"
                     Padding="2,0,0,0"
                     FontStyle="Italic" />
                            <Border x:Name="PART_SearchIconBorder"
                                  Grid.Column="1"
                                  BorderThickness="1"
                                  VerticalAlignment="Stretch"
                                  HorizontalAlignment="Stretch"
                                  BorderBrush="{StaticResource SearchTextBox_SearchIconBorder}"
                                  Background="{StaticResource SearchTextBox_SearchIconBackground}">
                                <Image x:Name="SearchIcon"
                                   Stretch="None"
                                   Width="15"
                                   Height="15" 
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Source="pack://application:,,,/Apex;component/Resources/Images/Search.png" />
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>

            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
